#pragma once

#include "SRNLUResult.h"
#include "SRNLUTypeDef.h"
#include "UIConfigResourceManager.h"
#include "UILogger.h"
#include "AudioFormat.h"
#include "SpeechError.h"

class SpeechRecognizer
{
public:
 	SpeechRecognizer(SREngineType type);
	virtual ~SpeechRecognizer(void);

	inline bool isInitialized(void)				{	return m_isInitialized; }
	inline SREngineType getEngineType(void)		{	return m_engineType;	}

	virtual SRError recFromMic(int sessionID, const char* logWavFileName, SRNLUResult *result) = 0;
	virtual SRError recFromFile(const char* filename, SRNLUResult *result) = 0;
	
	virtual bool initialize(void) = 0;
	virtual bool stopRecording(int sessionID) = 0;
	inline bool isRecording()					{	return m_isRecording;		}

protected:
	UIConfigResourceManager * m_pConfigurator;
	UILogger				* m_pLogger;

	bool					m_isInitialized;
	AudioFormat				m_targetFormat;
	AudioFormat				m_sourceFormat;
	std::string				m_soxPath;
	void convertFormat(const char* srcPath, const char* desPath);
	bool m_isRecording;

private:
	SREngineType m_engineType;
};
